#include <iostream>
#include <vector>
using namespace std;
vector<double> slution(vector<double> x, vector<double> y, vector<double> res);
int main()
{
    vector<double> x;
    vector<double> y;
    vector<double> res;
    //采样点个数
    int m;
    cin>>m;
    int arr[5] = {1,2,3,4,5};
    for(int i:arr)
    {
        cout<<arr[i]<<endl;
    }
    for(int i = 0;i<m;i++)
    {
        double numx,numy;
        cin>>numx>>numy;
        x.push_back(numx);
        y.push_back(numy);
    }
    res.push_back(18);
    res = slution(x,y,res);
    for(int i = 0;i<res.size();i++)
    {
        cout<<"观测值为" << res[i]<<endl;
    }
}
vector<double> slution(vector<double> x, vector<double> y, vector<double> res)
{
    int len = x.size();
    vector<double> temps;
    double temp;
    double result = 0;
    //cout<<res.size()<<len<<endl;
    for(int i = 0;i<res.size();i++)
    {

        double temp2 = res[i];
        //cout<<temp2<<endl;
        //计算yi*li
        for(int j = 0;j<len;j++)
        {
            temp = 1;
            for(int m = 0;m<len;m++)
            {
                if(j!=m)
                temp = temp*(temp2 - x[m]) / (x[j]-x[m]);
            }
            temp  = temp*y[j];
            result+=temp;
            cout<<result<<endl;
        }
        temps.push_back(result);
        //cout<<result<<endl;
    }
    return temps;
}
